<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix='fmt' uri="http://java.sun.com/jsp/jstl/fmt" %>  
<fmt:formatDate value="${content.createtime}" var="data" pattern="yyyy年MM月dd日HH点mm分ss秒" />
<style>
textarea {width:500px;height:60px;border:1px solid #abcdef;}
input[type=text] {width:100px;height:15px;border:1px solid #abcdef;}
select {width:100px;}
</style>
<script type="text/javascript">
var currentPageNumber = 1;
var gclazz = '';
var cusclazz = '';
 $(function(){ 
	 $.ajax({  
		   type: "POST",  
		   url: "district/viewAllDistrictsJson.html",  
		   dataType:"json",  
		   success: function(json){  
		     $("#bhaId").combobox({  
		        data:json.rows,  
		        valueField:'bha_id',  
		        textField:'bhaName',
		        onSelect:function(record){
		        	$.ajax({
		                type: "GET",
		                url: "block/getBlocksJson.html",
		                data: "districtId="+record.bha_id,
		                dataType: "json",
		                success: function (json) {
		                	 $("#bankuaiId").combobox({  
		         		        data:json.rows,  
		         		        valueField:'blockId',  
		         		        textField:'blockName',
		                	 });
		                }
		            });
		        }
		    });  
		   }  
		 });  
	 
	 $("#search").click(function(){
		 if($("#MainTab").tabs("exists","房屋信息列表")){
		       $("#MainTab").tabs("select","房屋信息列表");    
		       search();
		    }else{
		    	 $('#MainTab').tabs('add', {
		              title: '房屋信息列表',
		              href: '${pageContext.request.contextPath}/house/viewList.html',
		              closable: true,
		              closed: true
		          });	
		    }
	 });
	 
	 $("#reset").click(function(){
		 $("input[name^='start']").val("");		 
		 $("input[name^='end']").val("");		 
	 });
	 
 });
 
 
 
 function newHouseTab(clazz) {
	$('#clazz').combobox('setValue',clazz);
	$('#clazz').combobox('setText',clazz);
	 if($("#MainTab").tabs("exists","房屋信息列表")){
	       $("#MainTab").tabs("select","房屋信息列表");    
	       search();
	    }else{
	    	 $('#MainTab').tabs('add', {
	              title: '房屋信息列表',
	              href: '${pageContext.request.contextPath}/house/viewList.html',
	              closable: true,
	              closed: true
	          });	
	    }
 }
 
 function search() {
	 gclazz = $('#clazz').combobox('getValue');
	 $("#inputshopId").val($("#selshopId").combobox("getValue"));
	 $("#e_snid").val($("#employeeId").combobox("getValue"));
	 $('#searhfm').form('submit',{
		 success: function(result){
			 var result = eval('('+result+')');
			 if (result.errorMsg){
				 $.messager.show({
				 title: 'Error',
				 msg: result.errorMsg
				 });
			 } else {
				 $('#houseAll').datagrid({
						data: result
					});
				 page();

			 }
		 	}
		 });
 }
 
 function page() {
	 var pg = $('#houseAll').datagrid("getPager"); 
	 $(pg).pagination({ 
		 onSelectPage:function(pageNumber,pageSize){   
			 $('#page').val(pageNumber);
			 currentPageNumber = pageNumber;
			 search();
		 },
		 pageNumber:currentPageNumber
	 });
 }
 
 
 //客源
 function newCusTab(clazz) {
	 cusclazz  = clazz;
	 if($("#MainTab").tabs("exists","客源信息列表")){
	       $("#MainTab").tabs("select","客源信息列表");    
	  	 	$('#cusTable').datagrid('load',{
				clazz: cusclazz
			});
	    }else{
	    	 $('#MainTab').tabs('add', {
	              title: '客源信息列表',
	              href: '${pageContext.request.contextPath}/custome/viewList.html',
	              closable: true,
	              closed: true
	          });	
	    	 
	    }
 }
 
 //业绩
 function newBusinessTab(){
	 if($("#MainTab").tabs("exists","员工业绩报表")){ 
	    }else{
	    	 $('#MainTab').tabs('add', {
	              title: '员工业绩报表',
	              href: '${pageContext.request.contextPath}/kpi/index.html',
	              closable: true,
	              closed: true
	          });	
	    	 
	    }
 }
 //出勤
  function newWorkSchduel(){
	 if($("#MainTab").tabs("exists","员工出勤报表")){ 
	    }else{
	    	 $('#MainTab').tabs('add', {
	              title: '员工出勤报表',
	              href: '${pageContext.request.contextPath}/WorkSchedule/index.html',
	              closable: true,
	              closed: true
	          });	
	    	 
	    }
 }
</script>
<div class="easyui-layout" style="width:auto;height:550px;">
	<div data-options="region:'north'" style="height:70px;padding:2px;">
		<form id="searhfm" action="house/viewListJson.html" method="post">
			<input type="hidden" id="page" name="page" value="1"/>
			<input type="hidden" name="rows" value="200"/>
			<input type="hidden" name="shopId" id="inputshopId" value=""/>
			<input type="hidden" name="e_sn" id="e_snid" value=""/>
			<div style="margin-bottom: 2px;">
				<select name="clazz" id="clazz" class="easyui-combobox"  data-options="editable:false">
					<option value="租房">租房</option>
					<option value="二手">二手房</option>
					<option value="新房">新房</option>
				</select>
				<select name="districtId" id="bhaId" class="easyui-combobox"  data-options="editable:false">
				</select>
				<select name="type" class="easyui-combobox"  data-options="editable:false">
					<option value="-1">类型不限</option>
					<option value="多层住宅">多层住宅</option>
					<option value="小高层">小高层</option>
					<option value="高层住宅">高层住宅</option>
					<option value="公寓">公寓</option>
					<option value="商铺">商铺</option>
					<option value="写字楼">写字楼</option>
					<option value="商住楼">商住楼</option>
					<option value="独栋别墅">独栋别墅</option>
					<option value="联排别墅">联排别墅</option>
					<option value="叠加别墅">叠加别墅</option>
					<option value="双拼别墅">双拼别墅</option>
					<option value="多层复式">多层复式</option>
					<option value="民房">民房</option>
					<option value="洋房">洋房</option>
					<option value="四合院">四合院</option>
					<option value="厂房">厂房</option>
					<option value="车库">车库</option>
					<option value="地皮">地皮</option>
					<option value="其他">其他</option>
				</select>			
				租金:<input type="text"	name="startMoney" title="整数 如 1000 2000" class="easyui-tooltip"/>~<input type="text" name="endMoney" title="整数 如 1000 2000" class="easyui-tooltip" />	
				楼层	<input type="text"	name="startFloor" title="整数 如 1 2 3" class="easyui-tooltip"/>~<input type="text" name="endFloor" title="整数 如 1 2 3" class="easyui-tooltip"/>
				 <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" id="search">查询</a>	
			</div>
			<div>
				<select name="room" class="easyui-combobox"  data-options="editable:false">
					<option value="">户型不限</option>
					<option value="1">一室</option>
					<option value="2">二室</option>
					<option value="3">三室</option>
					<option value="4">四室</option>
					<option value="5">五室</option>
				</select>
				<select name="blockId" id="bankuaiId" class="easyui-combobox"  data-options="editable:false">
					<option value="-1">板块不限</option>
				</select>	
				<select name="decoration" class="easyui-combobox"  data-options="editable:false">
					<option value="-1">装修不限</option>
					<option value="1">毛坯</option>
					<option value="2">简单装修</option>
					<option value="3">中等装修</option>
					<option value="4">精装修</option>
					<option value="5">豪华装修</option>
				</select>			
				面积:<input type="text"	name="startArea" title="整数 如 50 100" class="easyui-tooltip"/>~<input type="text" name="endArea" title="整数 如 50 100" class="easyui-tooltip"/>	
				年代:<input type="text"	name="startAge" title="整数 如 2005 2010" class="easyui-tooltip"/>~<input type="text" name="endAge" title="整数 如 2005 2010" class="easyui-tooltip"/>
							 <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" id="reset">重设</a>		
			</div>
		</form>
	</div>
	<div data-options="region:'west'" style="width:200px">
	<!-- 操作区 -->
   		<div class="easyui-accordion" style="width:198px;height:470px;border:0px;">
   			<div title="房源管理" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;border:0px;">
   			 	<div style="float:left; margin: 20px;">
					<img alt="新房" src="${pageContext.request.contextPath}/images/home.png"  title="新房" onclick="newHouseTab('新房');">
				</div>
				<div style=" margin: 20px;">
					<img alt="二手" src="${pageContext.request.contextPath}/images/home.png" title="二手" onclick="newHouseTab('二手');">
				</div>	
				<div style="float:left; margin: 20px;">
					<img alt="租房" src="${pageContext.request.contextPath}/images/home.png" title="租房" onclick="newHouseTab('租房');">
				</div>
			</div>		
   			 <div title="客源管理" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;border:0px;">
				<div style="float:left; margin: 20px;">
					<img alt="二手客源" src="${pageContext.request.contextPath}/images/home.png" title="二手客源" onclick="newCusTab('二手房客源');">
				</div>
				<div style="float:left; margin: 20px;">
					<img alt="租房客源" src="${pageContext.request.contextPath}/images/home.png" title="租房客源" onclick="newCusTab('租房客源');">
				</div>
				<div style="float:left; margin: 20px;">
					<img alt="新房客源" src="${pageContext.request.contextPath}/images/home.png" title="新房客源" onclick="newCusTab('新房客源');">
				</div>								
			</div>
   			 <div title="业务管理" data-options="iconCls:'icon-ok'" style="overflow:auto;padding:10px;border:0px;">
				<div style="float:left; margin: 20px;">
					<img  src="${pageContext.request.contextPath}/images/userimage.png" title="业绩统计" onclick="newBusinessTab();">
				</div>	
				<div style="float:left; margin: 20px;">
					<img alt="员工出勤" src="${pageContext.request.contextPath}/images/userimage.png" title="出勤统计" onclick="newWorkSchduel();">
				</div>	
			</div>
   			 					
   		</div>
	</div>
	<div data-options="region:'center'">
		<div class="easyui-tabs" id="MainTab" style="width:auto;height:auto">
		</div>
	</div>
</div>

